<!DOCTYPE html>
<html lang="en">
<?php
	require_once('inc/weixiconfig.php');
	require_once('globals.php');
?>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.5,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>我的订单</title>
    <link rel="stylesheet" href="static/css/main.css">
    <link rel="stylesheet" href="static/css/order.css">
    <link href="https://cdn.bootcss.com/sweetalert/1.1.3/sweetalert.min.css" rel="stylesheet">
</head>
<body>
    <div id="myordercon">
        <ul class="navul">
            <li>全部</li>
            <li>待支付</li>
            <li>已预约</li>
            <li>已完成</li>
            <li>已取消</li>
        </ul>
        <div class="content" id="content"></div>
        <script type="text/html" id="contentTemp">
            {{each data value i}}
            <div class="list" data-tbid ={{value.tbid}}>
                <div class="ordernumbox">
                    <div class="ordernum">订单号：{{value.order_number}}</div>
                    {{if value.status == 0}}
                        <div class="status yiquxiao" style="width:27%">已取消</div>
                    {{else if value.status == 1}}
                        <div class="status daizhifu" style="width:27%">待支付</div>
                    {{else if value.status == 2 || value.status == 3}}
                        <div class="status yiyuyue" style="width:27%">已预约</div>
                    {{else}}
                    <div class="status yiwancheng" style="width:27%">已完成</div>
                    {{/if}}
                </div>
                <div class="con">
                    <div class="imgbox">
                        {{if value.type == 3}}
                        <img src="{{value.image}}" alt="">
                        {{else}}
                        <img src="static/img/ke.png" alt="">
                        {{/if}}
                    </div>
                    <div class="titlebox">
                        <span class="name">{{value.class_name}}</span>
                        {{if value.type == 3}}
                        <span class="time">预约日期：{{value.createtime}}</span>
                        <span class="tip">具体时间参看短信通知</span>
                        {{else}}
                        <span class="time">上课日期：{{value.class_time}}</span>
                        {{/if}}
                    </div>
                </div>
            </div>
            {{/each}}
        </script>
    </div>
</body>
</html>
<script src="http://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
<script src="http://cdn.bootcss.com/sweetalert/1.1.3/sweetalert.min.js"></script>
<script src="js/aui-art-template-a880d14/lib/template-web.js" charset="utf-8"></script>
<script type="text/javascript">
    $().ready(function(){
		wx.ready(function(){
			wx.hideMenuItems({
				menuList: [
					'menuItem:share:appMessage',
					'menuItem:share:timeline',
					'menuItem:share:qq',
					'menuItem:share:weiboApp',
					'menuItem:share:facebook',
					'menuItem:share:QZone',
					'menuItem:favorite'
				] // 要隐藏的菜单项，只能隐藏“传播类”和“保护类”按钮，所有menu项见附录3
			});
		});
        $('.navul li').click(function(){
            $(this).addClass('selectli').siblings().removeClass('selectli');
            if ($(this).index() == 0) {
                getlist();
            }else if ($(this).index() == 1) {
                getlist(1);
            }else if ($(this).index() == 2) {
                getlist(2);
            }else if ($(this).index() == 3) {
                getlist(3);
            }else {
                getlist(4);
            }
        })
        $('.navul li').eq(0).click();
        function getlist(type){
            $.ajax({
                type : "GET",
                async:false,
                url:'http://www.familyandtree.com/getcontent.php?ac=order_list',
                dataType : "json",
                data:{
                    type:type
                },
                success : function(data){
                    $('#content').html(template('contentTemp',data));
                    $('.content .list').click(function(){
                        window.location.href="myorder_detail.php?id="+$(this).data('tbid')
                    })
                },
                error:function(data){
                    swal({
        				button: false,
        				title: data.error,
        			});
                }
            });
        }
    })
</script>
